//公用js方法
export default {
  //深复制
  deepCopy(obj) {
    if (typeof obj != 'object') {
      return obj;
    }
    if(obj == null){
        return null;
    }
    var newobj = {};
    for (var attr in obj) {
      newobj[attr] = this.deepCopy(obj[attr]);
    }
    return newobj;
  },

  //两对象深合并
  deepMerge(obj1,obj2) {
    var key;
    for(key in obj2) {
        obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ?
        this.deepMerge(obj1[key], obj2[key]) : obj1[key] = obj2[key];
    }
    return obj1;
  },
}
